#pragma once
#include <string>
#include <set>
#include <functional>
#include "Singleton.h"
#include "MsgRouter.h"


class FlowService
{
public:
    bool Init();

public:
    FlowService() = default;
    virtual ~FlowService() = default;

public:
    static FlowService* Instance()
	{
		return CSingleton<FlowService>::Instance();
	}

public:
    void OnMatchReg(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, 
            std::uint32_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::uint32_t matchtype, std::int64_t matchtime);
    void OnCancleMatchReg(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, 
            std::uint64_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::int64_t matchtime, std::uint32_t matchtype, std::uint64_t associatedorder);
    void OnMatchSettlement(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, std::int64_t withdraw_limit, std::int64_t valid_flow,
            std::uint64_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::int64_t matchtime, std::uint32_t matchtype, std::int64_t reward,
            std::int64_t withdraw_limit_ratio);
    void OnMatchReward(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, std::int64_t withdraw_limit,
            std::uint64_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::int64_t matchtime, std::uint32_t matchtype, std::int64_t reward, std::int64_t reward_id,
            std::int64_t withdraw_limit_ratio, std::int32_t reward_type, std::int64_t reward_sum_limit,std::int32_t reward_cash);

    void OnPurchaseReg(std::int32_t result, std::int64_t balance, const std::string &provider, std::uint32_t user_id, 
        std::uint32_t agency_id, std::uint32_t game_id, std::uint64_t cycle, std::uint64_t order_id, std::uint64_t optime, std::int64_t fee, std::int64_t purchase_time); 
    void OnCancelPurchaseReg(std::int32_t result, std::int64_t balance, const std::string &provider, std::uint32_t user_id, 
        std::uint32_t agency_id, std::uint32_t game_id, std::uint64_t cycle, std::uint64_t optime, std::int64_t fee, std::int64_t purchase_time, std::uint64_t order_id, std::uint64_t cancel_purchase_orderid); 
            
protected:
    void RecordMatchReg(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, 
            std::uint32_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::uint32_t matchtype, std::int64_t matchtime);
    void RecordCancleMatchReg(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, 
            std::uint64_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::int64_t matchtime, std::uint32_t matchtype, std::uint64_t associatedorder);
    void RecordMatchSettlement(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, std::int64_t withdraw_limit, std::int64_t valid_flow,
            std::uint64_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::int64_t matchtime, std::uint32_t matchtype, std::int64_t reward,
            std::int64_t withdraw_limit_ratio);
    void RecordMatchReward(std::int32_t result, std::uint32_t uid, const std::string& provider, std::uint32_t agencyid, std::uint32_t gameid, std::int64_t withdraw_limit,
            std::uint64_t matchid, std::uint64_t orderid, std::uint64_t optime, std::int64_t balance, std::int64_t fee, std::int64_t matchtime, std::uint32_t matchtype, std::int64_t reward, std::int64_t reward_id,
            std::int64_t withdraw_limit_ratio, std::int32_t reward_type, std::int64_t reward_sum_limit, std::int32_t reward_cash);

    void RecordPurchaseReg(std::int32_t result, std::int64_t balance, const std::string &provider, std::uint32_t user_id, 
        std::uint32_t agency_id, std::uint32_t game_id, std::uint64_t cycle, std::uint64_t order_id, std::uint64_t optime, std::int64_t fee, std::int64_t purchase_time); 
    void RecordCancelPurchaseReg(std::int32_t result, std::int64_t balance, const std::string &provider, std::uint32_t user_id, 
            std::uint32_t agency_id, std::uint32_t game_id, std::uint64_t cycle, std::uint64_t optime, std::int64_t fee, std::int64_t purchase_time, std::uint64_t order_id, std::uint64_t cancel_purchase_orderid); 
};







